/*
 * Meal class is an object relating to each meal in the server
 */
package com.object;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.configuration.Configuration;

public class Meal {
	private int _id;
	private int _restaurant;		// The meal belongs to which restaurant (id)
	private String _name;				// Name of meal
	private String _description;	// Description of the restaurant
	private String _tag;			// Contains multiple tags in the ww,xx,yy,zz,, form
	private String _picture;		// URL of the profile picture of the restaurant 
	private String _price;			// Price of the meal
	
	public Meal(int id,int restaurant,String name,String description,String tag,String picture,String price){
		_id = id;
		_restaurant = restaurant;
		_name = name;
		_description = description;
		_tag = tag;
		_picture = picture;
		_price = price;
	}
	
	public int getId(){
		return _id;
	}
	
	public int getRestaurant(){
		return _restaurant;
	}
	
	public String getName(){
		return _name;
	}
	
	public String getDescription(){
		return _description;
	}
	
	/*
	 * return null if invalid index entered
	 * accepted value : 0 ~ Configuration.tagNumber-1
	 */
	public String getTagByIndex(int index){
		List<String> list = new ArrayList<String>(Arrays.asList(_tag.split(",")));
		if(index<list.size() && index>-1){
			return list.get(index);
		}else{
			return "";
		}
	}
	
	public String getPicture(){
		return _picture;
	}
	
	public String getPrice(){
		return _price;
	}
}

